package com.xinlu.common.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.xinlu.common.exception.handle.CommonExceptionHandle;
import com.xinlu.common.log.Logger;
import com.xinlu.derek.common.BaseAction;

public class ExceptionInterceptor extends CommonInterceptor {
	
	protected static Logger logger = Logger.getLogger(ExceptionInterceptor.class);

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		
		String forward = "";

		try {

			forward = invocation.invoke();

		} catch (Exception e) {

			CommonExceptionHandle commonExceptionHandle = new CommonExceptionHandle((BaseAction) invocation.getAction());

			// handle Exception
			forward = commonExceptionHandle.handleException(e);
		}

		return forward;
		
	}
	

	
}
